Send feedback on this topic.
Teradata.Client.Provider
TdDecimal Constructor(Int32[],Byte,Byte)
Example 



Teradata.Client.Provider Namespace > TdDecimal Structure > TdDecimal Constructor : TdDecimal Constructor(Int32[],Byte,Byte)
Array that contains the internal representation of the number.
Precision of the number.
Scale of the number.
This constructor will initialize a new instance of TdDecimal based on the supplied internal representation of a TdDecimal contained in the specified array.
Syntax
'Declaration
 
Public Function New( _
   ByVal input() As Integer, _
   ByVal precision As Byte, _
   ByVal scale As Byte _
)
'Usage
 
Dim input() As Integer
Dim precision As Byte
Dim scale As Byte
 
Dim instance As New TdDecimal(input, precision, scale)
public TdDecimal( 
   int[] input,
   byte precision,
   byte scale
)
public:
TdDecimal( 
   array<int>^ input,
   byte precision,
   byte scale
)

Parameters

input
Array that contains the internal representation of the number.
precision
Precision of the number.
scale
Scale of the number.
Exceptions
ExceptionDescription
input is null.
There are too many items in the input array.
Remarks

TdDecimal uses four 32 bit integers to internally store the number. The four integers will represent the decimal as a scaled 128 bit integer --the decimal point has been removed by multiplying the number by 10 to the power of the scale. This decimal is stored this way because it is very easy to perform operation on the decimal. The precision and scale are stored separately within TdDecimal.

The array that is passed in will have 4 elements which are the number components of the internal representation of the TdDecimal:

Example

The following is an example of setting up the array with a number, and then invoking the constructor.

// Decimal Number:          82985000914920.733988
// Hex Representation:      4 7FA5F2A8 A350FD24
Int32 [] numberComponents01 = {unchecked((Int32)0xA350FD24), (Int32)0x7FA5F2A8, (Int32)0x00000004, 0};
TdDecimal value01 = new TdDecimal(numberComponents01, 20, 6);
            
// Decimal Number:      -1
// Hex Representation:  FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF (two's compliment form)
Int32 [] numberComponents02 = {unchecked((Int32)0xFFFFFFFF), unchecked((Int32)0xFFFFFFFF),
                               unchecked((Int32)0xFFFFFFFF), unchecked((Int32)0xFFFFFFFF)};
TdDecimal value02 = new TdDecimal(numberComponents02, 1, 0);
Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdDecimal Structure
TdDecimal Members
Overload List